package com.pan.behavioral.status;

import com.pan.behavioral.status.pattern.Status;
import com.pan.behavioral.status.weather.Observatory;
import com.pan.behavioral.status.weather.Person;

/**
 * 状态模式
 * 将类的状态单独抽象出来封装成一个类，
 * 通过改变
 *
 */
public class StatusApplication {

    public static void main(String[] args) {
        Observatory observatory = new Observatory();
        Person person = new Person();
        for (int i = 0; i < 10; i++) {
            Status weather = observatory.getWeatherTips();
            person.setStatus(weather);
            person.displayBehavior();
        }
    }
}
